#ifndef VPDEMUXTHREAD_H
#define VPDEMUXTHREAD_H

#include <vppacketqueue.h>
#include <vpframequeue.h>
#include <thread>

extern "C"
{
#include <libavformat/avformat.h>
#include <libavutil/time.h>
}
#define MAX_QUEUE_SIZE 512
class VpDemuxThread
{
public:
    int                    m_seek_time;
    bool                   m_seek_req;

private:
    bool               m_stop;
    mutex              m_mutex;
    condition_variable m_cond;
public:
                VpDemuxThread();
    bool        start        (AVFormatContext *fmt_ctx, int audio_stream_idx, int video_stream_idx, VpPacketQueue *audio_pkt_queue, VpPacketQueue *video_pkt_queue, int *serial);
    void        stop         ();
    static void work         (VpDemuxThread* vp_demux_th, AVFormatContext *fmt_ctx, int audio_stream_idx, int video_stream_idx, VpPacketQueue *audio_pkt_queue, VpPacketQueue *video_pkt_queue, int *serial);
    void        seek_time    (int seek_time);

};

#endif // VPDEMUXTHREAD_H
